-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid flaky topo concurrency test #17407
base: main
Are you sure you want to change the base?
Avoid flaky topo concurrency test #17407
Conversation
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #17407 +/- ##
=======================================
Coverage ? 67.60%
=======================================
Files ? 1581
Lines ? 253945
Branches ? 0
=======================================
Hits ? 171683
Misses ? 82262
Partials ? 0 ☔ View full report in Codecov by Sentry. |
conn := &fakeConn{} | ||
statsConn := NewStatsConn("global", conn, testStatsConnReadSem) | ||
ctx := context.Background() | ||
|
||
go createTestReadSemaphoreContention(ctx, 100*time.Millisecond) | ||
semAcquiredChan := make(chan bool) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that it really matters here, but when you don't care about the value being passed you can use an empty struct literal which is zero bytes:
semAcquiredChan := make(chan struct{})
semAcquiredChan <- struct{}{}
Description
This PR avoids flakiness in the
TestStatsConnTopoListDir
andTestStatsConnTopoGet
unit tests ofgo/vt/topo
by ensuring the semaphore we hold to test semaphore-wait stats is acquired before testing aListDir
orGet
I don't see cases of this flakiness on our fork or upstream, but I think flakiness possible in extreme cases
Also, test logic was updated to use
require.Equal
,require.(No)Error
andrequire.(Not)Zero
Related Issue(s)
Checklist
Deployment Notes